package _14define._11homework;

public class Library {
    static class Book{
        private String title;
        private String auther;

        public Book(String title, String auther) {
            this.title = title;
            this.auther = auther;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getAuther() {
            return auther;
        }

        public void setAuther(String auther) {
            this.auther = auther;
        }
    }
    final Book[] books=new Book[10];
    {
        books[0]=new Book("斗破苍穹","天蚕土豆");
        books[1]=new Book("斗罗大陆","唐家三少");
    }




    void addBook(Book book){
        for (int i = 0; i < books.length; i++) {
            if (books[i]==null){
                books[i]=book;
                System.out.println("添加成功");
                break;
            }
        }
        System.out.println("------------");
        System.out.println("所有书籍信息");
        for (Book book1 : books) {
            if (book1!=null){
                System.out.println("书名:"+book1.title+" 作者:"+book1.auther);
            }
        }
    }
}
